home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / te2_110c.arc / SCRIPT.DOC < prev    next >
Text File  |  1991-04-02  |  93KB  |  2,094 lines

  1.                                       TE/2 Script Language Reference
  2.  
  3.                                                    Copyright 1991 by
  4.                                                      Oberon Software
  5.                                                518 Blue Earth Street
  6.                                                    Mankato, MN 56001
  7.  
  8.                                         Last Revision: April 2, 1991
  9.  
  10.  
  11.   -------------------------------------------------------------
  12.  
  13.  Copyright 1991, Oberon Software, Mankato, MN - All Rights Reserved
  14.  
  15.   -------------------------------------------------------------
  16.  
  17.  
  18.  
  19.      ----------------------------------------------------
  20.  
  21. Notice:  Information in this document is subject to change without
  22. notice and does not constitute a commitment on the part of Oberon
  23. Software.
  24.  
  25.      ----------------------------------------------------
  26.  
  27.  
  28. General:
  29. ========
  30.  
  31.   A TE/2 script file is a flat ASCII file containing TE/2 script
  32. commands.  Each line in the file must be terminated with either a
  33. carriage return-line feed pair or with a single line feed.  No line
  34. may be longer than 256 characters in length, a line longer than 256
  35. characters will generate an error message and terminate execution of
  36. the script.
  37.  
  38.   The TE/2 script language is not case sensitive, identifiers,
  39. keywords, functions, et al may be entered in either upper or lower
  40. case in any mixture.  Identifier names (variables, subroutine names)
  41. have no formal length restriction except as relates to the line
  42. length restriction given above.
  43.  
  44.   Blank lines within the script file are ignored as are any leading
  45. or trailing space or tab characters on a line.  You may indent and
  46. space the file any way you please for readability purposes.  The
  47. semicolon is the comment mark character.  Any and all text on a line
  48. including and following a semicolon (;) is ignored.  The obvious
  49. exception to this is when the semicolon appears within a quoted
  50. string.
  51.  
  52.  
  53.  
  54. Executing a script:
  55. ===================
  56.  
  57.   A script file may be executed in one of two ways.
  58.     1) Type Alt-/ (Alt-Slash) in terminal mode, at the "Command:"
  59. prompt type "call filename" where filename is the full file name
  60. (including path and extension) of the script to execute.
  61.     2) Associate a script file name (once again, full path and
  62. extension) with a dialing directory entry and make connection with
  63. that number.
  64.  
  65.  
  66.  
  67.  
  68. Program structure:
  69. ==================
  70.  
  71.   The general structure of a TE/2 script file is thus:
  72.  
  73.         variable declarations/definitions
  74.         subroutine definitions
  75.         program body
  76.  
  77.  
  78.  
  79. Constants:
  80. ==========
  81.  
  82.   Numeric Constants
  83.   -----------------
  84.  
  85.   Numeric constants are 32 bit, signed quantities.  A numeric constant
  86. may be expressed in standard decimal, hexadecimal, or octal notation
  87. and may range from -2147483647 to 2147483647.  Some examples of numeric
  88. constants are:
  89.                32, -768, 0x1b, 0333, 0x12345678
  90.  
  91.   There are several built in numeric constants. The most important of
  92. these are TRUE (1) and FALSE (0). There are others that are designed
  93. for special purposes, these will be covered in the appropriate
  94. sections.  Table 1 contains a list of these constants.
  95.  
  96.     Table 1.  -- Built in numeric constants
  97.     ---------------------------------------
  98.                     ansi_bbs
  99.                     ansi_te2
  100.                     ascii
  101.                     false
  102.                     ifcarrier
  103.                     query
  104.                     toggle
  105.                     true
  106.                     tty
  107.                     vt100
  108.                     xmodem
  109.                     xmodem1k
  110.                     ymodem
  111.                     ymodemg
  112.                     zmodem
  113.  
  114.  
  115.   Character Constants
  116.   -------------------
  117.  
  118.   Character constants are really just a special method of specifying
  119. an numeric constant.  A character constant is any single character
  120. between a pair of single quote marks (') or any two character Control
  121. Character sequence (See Table 2. below) between a pair of single
  122. quotes.  The result is the ASCII value of the specified character and
  123. it may be used anywhere a numeric constant or variable is allowed.
  124. To specify the ASCII value of the single quote character (39), simply
  125. use a sequence of three single quotes.
  126.  
  127.   Note that the character constant 'A' is exactly equal to ASCIIVAL("A")
  128. (See function ASCIIVAL below).
  129.  
  130.  
  131.  
  132.   String Constants
  133.   ----------------
  134.  
  135.   String constants are any string of ASCII characters delimited
  136. before and after with double quote marks (").  To embed a quote mark
  137. in a string use a sequence of two double quotes.  For example:
  138.  
  139.         "This string has ""quotes"" embedded into it."
  140.  
  141.   String constants should not exceed 256 characters in length.  This
  142. is not a hard and fast rule though exception handling for long
  143. strings may be less than robust at this point.
  144.  
  145.   The carat (^) character is treated specially, use it to embed
  146. control characters into a string. Table 2 lists all of the valid
  147. conversions.  If a carat character appears in any other situation in
  148. a quoted string it is ignored.  Note that ^! yields character 94
  149. which is itself the carat character, thus "^!" is the method of
  150. embedding the carat character itself into a string.  "^`" is a space
  151. character, this is interesting but not very useful.
  152.  
  153.  
  154.     Table 2.  -- Control character conversions
  155.     --------------------------------------------------------------
  156.        ^@         0        ^L or ^l  12       ^X or ^x  24
  157.        ^A or ^a   1        ^M or ^m  13       ^Y or ^y  25
  158.        ^B or ^b   2        ^N or ^n  14       ^Z or ^z  26
  159.        ^C or ^c   3        ^O or ^o  15       ^[        27
  160.        ^D or ^d   4        ^P or ^p  16       ^\        28
  161.        ^E or ^e   5        ^Q or ^q  17       ^]        29
  162.        ^F or ^f   6        ^R or ^r  18       ^^        30
  163.        ^G or ^g   7        ^S or ^s  19       ^_        31
  164.        ^H or ^h   8        ^T or ^t  20       ^`        32
  165.        ^I or ^i   9        ^U or ^u  21       ^!        94
  166.        ^J or ^j  10        ^V or ^v  22
  167.        ^K or ^k  11        ^W or ^w  23
  168.  
  169.  
  170.   There is one built in string constant, "null" which specifies the
  171. absence of a string.  Note that "null" is not the same as the string
  172. constant "".  The later is a representation of the empty string
  173. whereas "null" is no string at all; several functions in the TE/2
  174. script language will make a distinction.
  175.  
  176.  
  177. Variables:
  178. ==========
  179.  
  180.   Variable types and scope:
  181.   -------------------------
  182.  
  183.   User defined variables may be either string or integer variables.
  184. An integer variable is capable of holding a signed, 32 bit quantity -
  185. the same as the numeric constants mentioned above while a string
  186. variable may refer to anything expressible with a string constant.
  187.  
  188.   Variables may be local or global in scope.  If a variable is local,
  189. it is in effect for the current script file only; it is released when
  190. the script file ends execution and it is not available in any nested
  191. script file execution.  If a variable is global, it is in effect from
  192. the instant it is declared until TE/2 ends execution and exits back
  193. to the OS/2 prompt and it is available to any script file that
  194. executes thereafter and may even be used at the "Command:" prompt.
  195.  
  196.  
  197.   Declaring variables:
  198.   --------------------
  199.  
  200.   Variables are declared in the first section of the script file,
  201. anywhere before the "PROGRAM" statement except in a "SUBROUTINE"
  202. .. "ENDSUB" block.  A variable declaration has the following form:
  203.  
  204.         [GLOBAL] type name [ = expression ]
  205.  
  206.   If the "GLOBAL" scoping modifier is omitted, the variable is local
  207. in scope.  "type" is either "INTEGER" or "STRING".  A variable name
  208. must begin with an alphabetic character ("A" through "Z"), be
  209. comprised entirely of alphanumeric characters ("A" through "Z" plus
  210. "0" through "9"), and must not conflict with a TE/2 keyword or
  211. predefined variable.  If a GLOBAL variable name coincides with
  212. another GLOBAL variable already defined in another script file, it
  213. will refer to the same entity.  If a LOCAL variable has the same name
  214. as an already defined GLOBAL variable, it takes precedence over the
  215. GLOBAL variable for the duration of the current script file after
  216. which the GLOBAL variable will be reinstated.
  217.  
  218.   The optional initializing expression follows all of the rules given
  219. below for expressions.  Remember that it can't refer to any variables
  220. which are not yet declared.
  221.  
  222.  
  223. Subroutines:
  224. ============
  225.  
  226.   All subroutines must be defined before the "PROGRAM" statement in
  227. the script file.  The general form of a subroutine is:
  228.  
  229.         SUBROUTINE name
  230.           statements
  231.         ENDSUB
  232.  
  233. A subroutine name must begin with an alphabetic character and be
  234. composed entirely of alphanumeric characters.  Unlike variables, the
  235. name may conflict with a TE/2 script language keyword or a variable
  236. name but not with any other subroutine name in that script file.
  237.  
  238.   Rules for the statements in a subroutine are the same as the
  239. general rules given below except that the "RETURN" statement is only
  240. valid within a subroutine.  The "RETURN" statement is not strictly
  241. needed, the subroutine will exit back to the main line of code when
  242. it reaches the "ENDSUB" statement but the "RETURN" statement may be
  243. used to exit the subroutine early.
  244.  
  245.   A subroutine has access to all of the local variables defined in
  246. the script file even though they may have been declared later in the
  247. file.
  248.  
  249.  
  250.  
  251. Program body:
  252. =============
  253.  
  254.   After all variable declarations and subroutine definitions, the
  255. keyword "PROGRAM" is used to indicate the beginning of the main
  256. program body of the script file.  Execution of the script begins at
  257. the very next statement after the "PROGRAM" directive.  The program
  258. is composed of one or more statements.
  259.  
  260.  
  261. Statements:
  262. ===========
  263.  
  264.   A statement may be one of the following:
  265.         an assignment statement
  266.         a TE/2 function call
  267.         a control statement
  268.  
  269.  
  270.   Assignment statements:
  271.   ----------------------
  272.  
  273.   An assignment statement has the following form:
  274.  
  275.         variablename = expression
  276.  
  277. "variablename" must be the name of any LOCAL variable declared within
  278. that script file, any GLOBAL variable declared within some script
  279. file that has executed during this TE/2 session, or any TE/2
  280. system-global variable that is not specifically read-only (see list of
  281. keywords and system variables below).
  282.  
  283.   Depending on the type (INTEGER or STRING) of the variable on the
  284. left hand side, the expression may take either of the following
  285. forms:
  286.  
  287.     String expressions
  288.     ------------------
  289.  
  290.         Either a string variable, string literal, or string valued
  291.       function or the addition (concatenation) of two or more such
  292.       variables, literals or functions.
  293.  
  294.         Examples:
  295.                 stringvar = "fred flinstone"
  296.                 HelloMsg  = "Hello " + strleft("Worldwide", 5) + "^M^J"
  297.  
  298.  
  299.     Integer expressions
  300.     -------------------
  301.  
  302.         Either an integer variable, numeric constant, or integer
  303.       valued function or the algebraic combination of two or more
  304.       such variables, constants, or functions.
  305.  
  306.         Examples:
  307.                 intvar = 12345
  308.                 area = width * length
  309.                 loword = longval & 0x0000ffff
  310.  
  311.         The following operators are available for use in integer
  312.       expressions, given in the order of precedence.  Parenthesis
  313.       may be freely used to ensure the correct order of evaluation
  314.       and/or for clarity and readability.
  315.  
  316.       Table 3. -- Integer arithmetic operators
  317.       ----------------------------------------
  318.             -    Unary minus
  319.             ~    Unary bitwise negation
  320.             !    Unary logical negation
  321.  
  322.             &    Bitwise AND operator
  323.  
  324.             |    Bitwise OR operator
  325.             ^    Bitwise EXCLUSIVE-OR operator
  326.  
  327.             >>   Bitwise shift-right
  328.             <<   Bitwise shift-left
  329.  
  330.             *    Multiplication
  331.             /    Division
  332.             %    Modulus
  333.  
  334.             +    Addition
  335.             -    Subtraction
  336.  
  337.             AND  Logical AND
  338.             OR   Logical OR
  339.  
  340.             >    Relational Greater-Than
  341.             <    Relational Less-Than
  342.             >=   Relational Greater-Than-Or-Equal
  343.             <=   Relational Less-Than-Or-Equal
  344.             !=   Relational Not-Equal
  345.             ==   Relational Equality
  346.  
  347.  
  348.  
  349.   TE/2 Function calls:
  350.   --------------------
  351.  
  352.   The TE/2 script file language has a rich set of built in functions
  353. which are listed alphabetically below in the Function Directory.  In
  354. general, each function has a return value, either INTEGER or STRING
  355. and may appear in the right hand side of an expression as discussed
  356. above but a function (indeed an entire expression, see below) may also
  357. appear on a line of its own in the script file.  In this case the
  358. function is evaluated (usually for its actions or side effects) and
  359. the return value is discarded.  Clearly, this is not advantageous for
  360. some functions such as GETENV or STRLEN whose entire purpose in life
  361. is to return some information however it may be just the ticket for
  362. action functions like CHAT, SCROLLBACK, or even WAITFOR if you aren't
  363. interested in the return value.
  364.  
  365.   It was mentioned that an entire expression could appear on a line
  366. in the script file.  The following is a perfectly valid statement:
  367.  
  368.         waitfor("Select:", 60) + 5 + atoi("1234")
  369.  
  370. however the result (1239 or 1240 if WAITFOR was successful) will be
  371. discarded.  You might be tempted to write:
  372.  
  373.         waitfor("Select:", 60) + transmit("m^M")
  374.  
  375. instead of:
  376.  
  377.         waitfor("Select:", 60)
  378.         transmit("m^M")
  379.  
  380. however you should NOT depend on left-to-right evaluation of this
  381. or any expression as it may not be the case in future versions of
  382. TE/2 or in the compiled language when it become available. 
  383. Likewise, Boolean statements (those which use AND, OR, the logical
  384. negation (!), and/or the relational operators are NOT short circuited
  385. once their results are clear (as they are in "C", for instance);
  386. expect all terms of a Boolean expression to be evaluated.
  387.  
  388.  
  389.   Control statements:
  390.   -------------------
  391.  
  392.   The following is a brief summary of the program control structures
  393. available in the TE/2 script language.
  394.  
  395.       Subroutines:
  396.       ------------
  397.  
  398.         GOSUB subname           { subname must be defined in file }
  399.         RETURN                  { valid within a subroutine only }
  400.  
  401.                 Notes: The subroutine has access to all variables
  402.                 that are available at the main line level.  The
  403.                 program location after the GOSUB statement is saved
  404.                 and restored when the RETURN statement is encountered
  405.                 or when an ENDSUB statement is reached.  Subroutines
  406.                 may call other subroutines in the same file. The END
  407.                 statement may be used within the subroutine with the
  408.                 same results as using it in the main program body.
  409.  
  410.  
  411.       IF-ELSEIF-ELSE structure:
  412.       -------------------------
  413.  
  414.         IF num-expression
  415.           statements
  416.         [ELSEIF num-expression  { any number of ELSEIF clauses are }
  417.           statements            { allowed }
  418.         ELSEIF num-expression
  419.           .
  420.           .]
  421.         [ELSE                   { ELSE statement is optional }
  422.           statements]
  423.         ENDIF
  424.  
  425.  
  426.  
  427.       Loop structures:
  428.       ----------------
  429.  
  430.         DO                      { loop forever }
  431.           statements
  432.         LOOP
  433.  
  434.         DO WHILE num-expression
  435.           statements
  436.         LOOP
  437.  
  438.         DO UNTIL num-expression
  439.           statements
  440.         LOOP
  441.  
  442.         DO
  443.           statements
  444.         LOOP WHILE num-expression
  445.  
  446.         DO
  447.           statements
  448.         LOOP UNTIL num-expression
  449.  
  450.         BREAK                   { exit current loop structure }
  451.         CONTINUE                { branch to top of current loop structure }
  452.  
  453.                 Notes: In the DO WHILE..LOOP and DO UNTIL..LOOP
  454.                 structures, the control expression is evaluated at
  455.                 the beginning of the loop, execution may never enter
  456.                 the loop if the expression does not evaluate
  457.                 correctly for that style of loop.  In the DO..LOOP
  458.                 WHILE and DO..LOOP UNTIL forms, the expression is
  459.                 evaluated at the end of the loop, the loop will
  460.                 always be executed at least once.
  461.                 The BREAK statement will exit the current loop
  462.                 structure.  If execution is within nested loops, only
  463.                 the innermost loop will be exited.  The BREAK
  464.                 statement is the only way to exit the first form of
  465.                 the DO..LOOP structure.
  466.                 The CONTINUE statement transfers control back to the
  467.                 top of the loop structure.  If it is of the form
  468.                 DO WHILE..LOOP or DO UNTIL..LOOP, the expression is
  469.                 immediately reevaluated.
  470.  
  471.  
  472.       Other controls:
  473.       ---------------
  474.  
  475.         END                     { terminate current script file even
  476.                                   if currently in subroutine }
  477.  
  478.         STOP                    { terminate current script file and
  479.                                   all calling script files }
  480.  
  481.         RUN(str-expression)     { execute script file - control
  482.                                   returns to current file when called
  483.                                   file ends }
  484.  
  485.         PROCESS                 { recursively execute a TE/2 terminal
  486.                                   session, script file is suspended
  487.                                   until an EXIT() is performed. Note
  488.                                   that Alt-X generates an EXIT() by
  489.                                   default }
  490.  
  491.         EXIT(num-expression)    { terminate current PROCESS level or
  492.                                   terminate TE/2 if not in a PROCESS
  493.                                   shell }
  494.  
  495.   Note that the END statement is not strictly necessary, the script
  496. file will terminate when it reaches the end of the file.
  497.  
  498.   Please note that loop structures, IF blocks and subroutines must be
  499. properly nested.  The TE/2 script language interpreter may detect a
  500. faulty nesting and terminate with an error but the problem may not be
  501. detected in some pathological cases until execution has already
  502. progressed in an erroneous manner for a while.  The following are
  503. examples of incorrect block nesting.
  504.  
  505.     Incorrect nesting:
  506.     ------------------
  507.         counter = 0
  508.         do while counter < 50
  509.           if counter == 25
  510.             loop
  511.           endif
  512.           counter = counter + waitfor("Next", 10)
  513.         loop
  514.  
  515.     Correct nesting:
  516.     ----------------
  517.         counter = 0
  518.         do while counter < 50
  519.           if counter == 25
  520.             continue
  521.           endif
  522.           counter = counter + waitfor("Next", 10)
  523.         loop
  524.  
  525.           
  526.     Incorrect nesting:
  527.     ------------------
  528.         if stricmp(strg1, strg2) == 0
  529.           message("^M^Jwaiting")
  530.           do
  531.             message(".")
  532.         else
  533.             message("!")
  534.           until waitfor(strg2, 1)
  535.         endif
  536.  
  537.  
  538.  
  539. Keywords:
  540. =========
  541.  
  542.   This is a list of reserved words within the TE/2 script language. 
  543. In addition to these words, no user variable may have the same name
  544. as a system-global variable (see below).
  545.  
  546.     Table 4. -- TE/2 script language reserved words
  547.     -----------------------------------------------
  548.           abs             getc            setxonxoff
  549.           and             getenv          shell
  550.           ansi_bbs        gets            sleep
  551.           ansi_te2        getyesno        snapshot
  552.           ascii           global          sprintf
  553.           asciival        gosub           status
  554.           atoi            itoa            stop
  555.           beep            if              strcmp
  556.           break           itoa            strdate
  557.           cancelwatch     integer         strget
  558.           chat            itoa            stricmp
  559.           chdir           lfaftercr       string
  560.           chdisk          localecho       strleft
  561.           closedialog     logclose        strlen
  562.           cls             logfile         strput
  563.           connected       logopen         strright
  564.           continue        logpause        strstr
  565.           date            loop            strtime
  566.           dial            mainmenu        strtrim
  567.           directory       message         subroutine
  568.           download        muxwait         substr
  569.           do              null            termecho
  570.           download        opendialog      time
  571.           dumpinit        or              timedout
  572.           else            parmsmnu        toggle
  573.           elseif          pgmmenu         tolower
  574.           execpgm         process         toupper
  575.           end             program         trace
  576.           endif           query           transmit
  577.           endsub          queuedial       true
  578.           errormsg        redial          tty
  579.           execpgm         rename          until
  580.           exit            restorescr      upload
  581.           false           return          vt100
  582.           fclose          rgetc           waitfor
  583.           feof            rgets           watchfor
  584.           ferror          rshell          weekday
  585.           fgetc           run             while
  586.           fgets           savescr         xmodem
  587.           fnkey           scrollback      xmodem1k
  588.           fopen           sendbreak       ymodem
  589.           fputc           sendbyte        ymodemg
  590.           fputs           sendinit        zmodem
  591.           fseek           setctsrts
  592.           ftell           setparms
  593.  
  594.  
  595.     Table 4a. -- Additions to the reserved words list
  596.     -------------------------------------------------
  597.           cursorrow       cursorcol       erase
  598.           kbdabort        keypressed      jdate
  599.           julian          julian2         jwday
  600.           setcursor
  601.  
  602.  
  603.  
  604. TE/2 System-Global Variables:
  605. =============================
  606.  
  607.   The following are the system-global variables (those which are
  608. usually set in TE2.INI) which may be referred to in script language
  609. statements.  The type (INTEGER or STRING) of each is given by its
  610. name.  In general, these variables may also appear on the left-hand
  611. side of an assignment statement, i.e.:
  612.  
  613.         modemInitStrg = "ATE0 V1 X6^M^J"
  614.  
  615. Those which cannot be assigned directly are marked with an asterisk.
  616. The marked variables must be set/reset through other means (usually a
  617. function is provided, in some cases only through a TE/2 dialog box or
  618. only from TE2.INI).
  619.  
  620.     Table 5. -- TE/2 system-global variables
  621.     ----------------------------------------------
  622.      * indicates read-only variable w.r.t assignment statements
  623.  
  624.         TermAttr           - INTEGER
  625.         MenuNormAttr       - INTEGER
  626.         MenuHiAttr         - INTEGER
  627.         LogoAttr           - INTEGER
  628.         DLogNormAttr       - INTEGER
  629.         DLogHiAttr         - INTEGER
  630.         DLogDaAttr         - INTEGER
  631.         DLogEdAttr         - INTEGER
  632.         DLogEdHiAttr       - INTEGER
  633.         shadowAttr         - INTEGER
  634.         dialNormAttr       - INTEGER
  635.         dialHiAttr         - INTEGER
  636.         ErrorAttr          - INTEGER
  637.         ScrlBackAttr       - INTEGER
  638.         chatAttr           - INTEGER
  639.         cmdPromptAttr      - INTEGER
  640.         cmdInputAttr       - INTEGER
  641.         cmdInputHiAttr     - INTEGER
  642.  
  643.         LocalEcho          - INTEGER
  644.         dtrHangUp          - INTEGER
  645.         LFafterCR          - INTEGER
  646.         AutoZM             - INTEGER
  647.         MatchBaud          - INTEGER
  648.         AutoDirSave        - INTEGER
  649.         chatBuffered       - INTEGER
  650.         te2DEBUG           - INTEGER
  651.         alarmPopUp         - INTEGER
  652.         MenuActive         - INTEGER *
  653.         colorLock          - INTEGER
  654.  
  655.         BreakLen           - INTEGER
  656.         dialerTimeOut      - INTEGER
  657.         alarmType          - INTEGER
  658.         alarmTime          - INTEGER
  659.         ForceLines         - INTEGER
  660.         ScrlBackLns        - INTEGER *
  661.         redialDelay        - INTEGER
  662.         LogoDelay          - INTEGER
  663.         QueryHangUp        - INTEGER
  664.         ClobberDL          - INTEGER
  665.  
  666.         modemInitStrg      - STRING
  667.         modemDialStrg      - STRING
  668.         modemDialSufx      - STRING
  669.         modemHangStrg      - STRING
  670.         modemAnsStrg       - STRING
  671.         modemOKStrg        - STRING
  672.         modemDelayChar     - INTEGER
  673.         enqReply           - STRING
  674.  
  675.         clogFile           - STRING  *
  676.         logPath            - STRING
  677.         dfltDLPath         - STRING
  678.         dfltULPath         - STRING
  679.         scriptPath         - STRING
  680.         shellCmd           - STRING
  681.  
  682.         Device             - STRING  *
  683.         Port               - INTEGER *
  684.         Baud               - INTEGER *
  685.         Parity             - INTEGER *
  686.         WordLen            - INTEGER *
  687.         StopBits           - INTEGER *
  688.         XonXoff            - INTEGER *
  689.         CtsRts             - INTEGER *
  690.  
  691.         ULPrtyClass        - INTEGER
  692.         DLPrtyClass        - INTEGER
  693.  
  694.  
  695. Other System variables:
  696. =======================
  697.  
  698.   The following are other read-only variables, maintained by the
  699. system which may not be set in any way.  Their values may only be
  700. examined.
  701.  
  702.          connected  - INTEGER, TRUE if TE/2 is online
  703.          curdir     - STRING, the current subdirectory
  704.          cursorcol  - INTEGER, current horizontal postion of the
  705.                         cursor, leftmost column is 0
  706.          cursorrow  - INTEGER, current vertical position of the
  707.                         cursor, topmost row is 0
  708.          date       - INTEGER, the current date in packed format
  709.          time       - INTEGER, the current time in packed format
  710.          timedout   - INTEGER, TRUE if last WAITFOR, MUXWAIT, RGETS
  711.                         ended because of a timeout
  712.          kbdabort   - INTEGER, TRUE if last WAITFOR, MUXWAIT, RGETS
  713.                         ended because of ESCape was typed
  714.          keypressed - INTEGER, TRUE if a local keystroke is pending
  715.          strdate    - STRING, the current date in string format
  716.          strtime    - STRING, the current time in string format
  717.          weekday    - STRING, the current day of the week, one
  718.                         of: "Sun", "Mon", "Tue", "Wed", "Thu",
  719.                         "Fri", or "Sat".
  720.  
  721.   Note: the formats of the date and time strings are determined by
  722. querying OS/2 for the current codepage.
  723.  
  724.   Note: the formats of the date and time numeric variables are:
  725.  
  726.           year   = (date & 0xffff0000) >> 16
  727.           month  = (date & 0x0000ff00) >> 8
  728.           day    =  date & 0x000000ff
  729.  
  730.           hour   = (time & 0xff000000) >> 24
  731.           minute = (time & 0x00ff0000) >> 16
  732.           second = (time & 0x0000ff00) >> 8
  733.           hunds  =  time & 0x000000ff
  734.  
  735.  
  736.  
  737.  
  738. Function directory:
  739. ===================
  740.  
  741.   All functions are invoked by giving their names plus a pair of
  742. parentheses containing the list of arguments.  In some cases, a
  743. function may not require an argument list, in these cases the empty
  744. parentheses are still required.
  745.  
  746.   In the function directory below, the format is: the function name
  747. is listed and, in the parentheses, the type of each required argument
  748. is given.  If no arguments are required, the word "void" appears in
  749. the parentheses.  Some functions receive "special" parameters;
  750. usually these will be taken from a select set of predefined constants
  751. (as mentioned in the section on constants above).  In these cases,
  752. the word "special" will appear in that argument position and an
  753. explanation will be given in the text.  If a function takes a
  754. variable number of arguments, this is indicated by ending the
  755. argument list with three dots ("...").
  756.  
  757.  
  758.     ABS(integer)
  759.         Returns: INTEGER, the absolute value of its argument
  760.  
  761.  
  762.     ASCIIVAL(string)
  763.         Returns: INTEGER, the ASCII value of the first character of
  764.                           its argument
  765.  
  766.  
  767.     ATOI(string)
  768.         Returns: INTEGER, the numeric value of the argument
  769.         Notes:  this function understands hex and octal notation,
  770.                 thus ATOI("27") and ATOI("0x1b") and ATOI("033")
  771.                 all return the same value, 27.
  772.  
  773.  
  774.     BEEP(integer, integer)
  775.         Returns: INTEGER, always TRUE
  776.         Notes:  this function will sound the console beeper, the
  777.                 first parameter specifies the frequency (pitch) of
  778.                 the sound, the second the duration.
  779.  
  780.  
  781.     CANCELWATCH(integer)
  782.         Returns: INTEGER, TRUE or FALSE
  783.         Notes:  The argument must be a 'watch handle' created via a
  784.                 previous call to WATCHFOR.  This function releases
  785.                 the watch.  It returns FALSE if the watch did not
  786.                 exist, TRUE otherwise.
  787.                 See also WATCHFOR.
  788.  
  789.     CHAT(void)
  790.         Returns: INTEGER, always TRUE
  791.         Notes:  Activates chat mode, same as Alt-G from terminal mode
  792.  
  793.  
  794.     CHDIR(string)
  795.         Returns: INTEGER, TRUE or FALSE
  796.         Notes:  the argument specifies a subdirectory, this function
  797.                 will attempt to change the current working directory
  798.                 on the current or specified disk, it will NOT change
  799.                 the currently logged disk however.  CHDIR returns
  800.                 TRUE if it was successful. (See CHDISK)
  801.         Examples:
  802.                 CHDIR("D:\")
  803.                 CHDIR("\comm\log")
  804.  
  805.  
  806.     CHDISK(string)
  807.         Returns: INTEGER, TRUE or FALSE
  808.         Notes:  the first character of the argument should specify a
  809.                 disk letter.  This function will attempt to make that
  810.                 the current drive.  It returns TRUE if it was
  811.                 successful. (See CHDIR)
  812.  
  813.  
  814.     CLOSEDIALOG(integer)
  815.         Returns: INTEGER, always TRUE
  816.         Notes:  The argument MUST be a handle to a dialog that has
  817.                 been created by an earlier call to OPENDIALOG.
  818.                 Restores the area of the screen which was saved during
  819.                 the OPENDIALOG call and frees up all memory associated
  820.                 with this dialog.
  821.  
  822.  
  823.     CLS(void)
  824.         Returns: INTEGER, always TRUE
  825.         Notes:  Clears the terminal screen to the current attribute.
  826.  
  827.  
  828.     DIAL(string OR integer)
  829.         Returns: INTEGER, TRUE or FALSE
  830.         Notes:  If the argument is an integer or if it is a string
  831.                 with the format "#nnn" where the n's are digits, DIAL
  832.                 will attempt to dial the indicated entry in the
  833.                 current dialing directory.  If it is a string and
  834.                 not "#nnn" format, then if the first character is a
  835.                 digit it will manually dial the string, else if the
  836.                 string is not empty it will search for a TAG in the
  837.                 current dialing directory that matches and dial that
  838.                 entry.  If the string is empty, the user is prompted
  839.                 for a number (this is equivalent to typing Alt-M from
  840.                 terminal mode).  DIAL returns TRUE if a connection
  841.                 was made.
  842.  
  843.  
  844.     DIRECTORY(void)
  845.         Returns: INTEGER, TRUE or FALSE
  846.         Notes:  This is equivalent to typing Alt-D from terminal
  847.                 mode.  DIRECTORY returns TRUE if a connection was
  848.                 made.
  849.  
  850.  
  851.     DOWNLOAD(special, string)
  852.         Returns: INTEGER, TRUE or FALSE
  853.         Notes:  The "special" parameter must be one of the following
  854.                 pre-defined constants: XMODEM, XMODEM1K, YMODEM,
  855.                 YMODEMG, ZMODEM, or QUERY.  If this parameter is
  856.                 QUERY, the user is prompted for the protocol.  The
  857.                 second parameter is the file name, if it is the empty
  858.                 string, XMODEM and XMODEM1K will prompt the user for
  859.                 the filename, this parameter is ignored by YMODEM,
  860.                 YMODEMG, and ZMODEM.
  861.                 The function returns TRUE if the file transfer ended
  862.                 with no fatal errors.  (See UPLOAD)
  863.  
  864.  
  865.     DUMPINIT(void)
  866.         Returns: INTEGER, always TRUE
  867.         Notes:  Prints the current value of all the system-global
  868.                 values settable via TE2.INI to the terminal screen.
  869.  
  870.  
  871.     EMULATE(special)
  872.         Returns: INTEGER, the new emulation.
  873.         Notes:  The "special" parameter must be one of the following
  874.                 pre-defined constants: TTY, ANSI_BBS, ANSI_TE2,
  875.                 VT100, or QUERY.  If it is QUERY, the user is
  876.                 prompted for the emulation.
  877.  
  878.  
  879.     ERASE(string)
  880.         Returns: INTEGER, 0 on success, -1 on error
  881.         Notes:  This function will delete the indicated file from
  882.                 the disk.  Clearly, you should use this function
  883.                 with care.
  884.  
  885.     ERRORMSG(string, string)
  886.         Returns: INTEGER, always TRUE
  887.         Notes:  Displays the error message dialog (TE/2 uses this
  888.                 dialog for most all, non-script related errors).
  889.                 String1 is left justified on the first line of the
  890.                 dialog, string2 centered on the second and "Strike
  891.                 any key to continue" is placed at the bottom of the
  892.                 dialog.  ErrorAttr from the initialization file is
  893.                 used for the dialog color.  The portion of the screen
  894.                 overlaid by the dialog is saved and restored when the
  895.                 dialog is exited.
  896.  
  897.  
  898.     EXECPGM(string, string, string, integer, integer)
  899.         Returns: INTEGER
  900.         Notes:  The arguments are, in order, session_title, program_name,
  901.                 program_args, exec_type, and exec_flags.  These parameters
  902.                 map directly to the information contained in the external
  903.                 program file that TE/2 uses to build the "User Programs"
  904.                 menu (Alt-J), you should refer to the TE/2 Manual for
  905.                 more information on these settings.  All of the functionality
  906.                 for user input and global value passing that is referred
  907.                 to there is present here.  The exec_flags parameter is NOT
  908.                 optional for this call like it is in the external programs
  909.                 file however.
  910.                 The return value of EXECPGM() depends on the mode in which
  911.                 the child process was executed.  A return value of -1 will
  912.                 usually indicate an invalid parameter list.  If the child
  913.                 was executed in the background or in a new session, the
  914.                 return value is zero for success or the error code which
  915.                 was returned by OS/2.  If the child was executed as a
  916.                 foreground process, the return value is the exit code of
  917.                 the child program (i.e., the value which it passed to
  918.                 DosExit()).
  919.  
  920.  
  921.     EXIT(special)
  922.         Returns: INTEGER, TRUE or FALSE
  923.         Notes:  The "special" parameter must be one of the following
  924.                 pre-defined constants: TRUE, FALSE, IFCARRIER.  If it
  925.                 is FALSE, the user will be asked for confirmation
  926.                 before exiting, if TRUE TE/2 will unconditionally
  927.                 exit, if QUERY the user will be queried only if the
  928.                 carrier is high (TE/2 is online).
  929.                 The function returns TRUE if TE/2 is exiting
  930.                 (although you won't be able to test this, if the
  931.                 function returns to the script at all it should do so
  932.                 with FALSE).
  933.  
  934.  
  935.     FNKEY(integer)
  936.         Returns: INTEGER, TRUE or FALSE
  937.         Notes:  If the argument is zero or greater than 48, the
  938.                 function key menu is activated, this is equivalent
  939.                 to typing Alt-K from terminal mode.  If it is a
  940.                 number from 1 to 48, the corresponding function key
  941.                 macro is transmitted.
  942.                         1 - 12  -> unshifed function keys 1-12
  943.                        13 - 24  -> shifted function keys 1-12
  944.                        25 - 36  -> control-function keys 1-12
  945.                        37 - 48  -> alt-function keys 1-12
  946.                 The function returns TRUE if a macro was transmitted.
  947.  
  948.  
  949.     FCLOSE(integer)
  950.         Returns:  INTEGER, TRUE or FALSE
  951.         Notes:  The argument should be the value returned from an
  952.                 earlier call to FOPEN (see notes on file handling).
  953.                 This function returns TRUE if the file was
  954.                 successfully closed.
  955.  
  956.  
  957.     FEOF(integer)
  958.         Returns:  INTEGER, TRUE or FALSE
  959.         Notes:  The argument should be the value returned from an
  960.                 earlier call to FOPEN (see notes on file handling).
  961.                 This function returns TRUE if the current file
  962.                 pointer position is at the end of file.
  963.  
  964.  
  965.     FERROR(integer)
  966.         Returns:  INTEGER, error code
  967.         Notes:  The argument should be the value returned from an
  968.                 earlier call to FOPEN (see notes on file handling).
  969.                 This function returns FALSE if no error has occurred
  970.                 accessing the indicated file, else it is an error
  971.                 code.
  972.  
  973.  
  974.     FGETC(integer)
  975.         Returns:  INTEGER, character code or -1
  976.         Notes:  The argument should be the value returned from an
  977.                 earlier call to FOPEN (see notes on file handling).
  978.                 This function returns the next character in a file
  979.                 which has been opened for input.  A -1 result is
  980.                 used to indicate end-of-file or error (See FEOF and
  981.                 FERROR).
  982.  
  983.  
  984.     FGETS(integer)
  985.         Returns:  STRING, input from file
  986.         Notes:  The argument should be the value returned from an
  987.                 earlier call to FOPEN (see notes on file handling).
  988.                 This function reads a line of text from a file opened
  989.                 for input.  It reads all characters up to and
  990.                 including a newline character ("^J", see notes on
  991.                 file handling for information about newline
  992.                 translation) or 1024 characters, whichever occurs
  993.                 first. It returns and empty string to indicate
  994.                 end-of-file or error (See FEOF and FERROR).
  995.  
  996.  
  997.     FOPEN(string, string)
  998.         Returns: INTEGER, file handle
  999.         Notes:  This function MAY NOT be called outside the context
  1000.                 of and assignment statement.  It opens a file and
  1001.                 its return value is a "handle" for all the other
  1002.                 file oriented functions (FGETC, FEOF, FCLOSE, etc).
  1003.                 Care should be taken with this value so that it not
  1004.                 altered in any way until FCLOSE has safely been
  1005.                 called.
  1006.                 The first argument is a file name, the second is the
  1007.                 open "mode" and should be one of "r", "w", "a", "rt",
  1008.                 "rb", "wt", "wb", "at", "ab", "r+t", "w+t", "a+t",
  1009.                 "r+b", "w+b", or "a+b" (see notes on file handling
  1010.                 for an explanation).
  1011.                 If the function returns 0, the file was not opened.
  1012.  
  1013.  
  1014.     FPUTC(integer, integer)
  1015.         Returns:  INTEGER, the output character or -1
  1016.         Notes:  The second argument should be the value returned from
  1017.                 an earlier call to FOPEN (see notes on file handling).
  1018.                 The first argument is the ascii value of the
  1019.                 character to be output to the file, the file must
  1020.                 have been opened in a mode which allows writing of
  1021.                 data ("w", "a", etc).  A return value of -1 indicates
  1022.                 an error situation (see FEOF and FERROR).
  1023.  
  1024.  
  1025.     FPUTS(string, integer)
  1026.         Returns:  INTEGER, the last output character or -1
  1027.         Notes:  The second argument should be the value returned from
  1028.                 an earlier call to FOPEN (see notes on file handling).
  1029.                 The first argument is the string to write to the file.
  1030.                 The file must have been opened in a mode which allows
  1031.                 writing of data ("w", "a", etc).  A return value of
  1032.                 -1 indicates an error (see FEOF and FERROR).
  1033.  
  1034.  
  1035.     FSEEK(integer, integer, special)
  1036.         Returns:  INTEGER, TRUE or FALSE
  1037.         Notes:  The first argument should be the value returned from
  1038.                 an earlier call to FOPEN (see notes on file handling).
  1039.                 The second integer specifies an offset into the file
  1040.                 which may be positive, negative, or zero depending
  1041.                 upon the mode specified in the third argument.
  1042.                 This function will attempt to move the current file
  1043.                 location pointer in the indicated file to a number
  1044.                 of bytes (specified in the second argument) from the
  1045.                 origin (specified in the third argument).  The third
  1046.                 argument MUST be one of:
  1047.                         0 -- beginning of file
  1048.                         1 -- current position in file
  1049.                         2 -- end of file
  1050.                 If this function returns false, an error has occurred.
  1051.                 (see FEOF and FERROR)
  1052.  
  1053.  
  1054.     FTELL(integer)
  1055.         Returns:  INTEGER, 
  1056.         Notes:  The argument should be the value returned from an
  1057.                 earlier call to FOPEN (see notes on file handling).
  1058.                 This function retrieves the current location pointer
  1059.                 in the indicated file.  A return value of -1
  1060.                 indicates an error (see FOEF and FERROR).
  1061.  
  1062.  
  1063.     GETC(void)
  1064.         Returns: INTEGER, keystroke value or zero
  1065.         Notes:  Waits for the user to type a key and returns the value
  1066.                 of the keystroke.  If an error occurred, the return
  1067.                 is zero, if it was a 'standard' key, the return is
  1068.                 the ASCII value of the keystroke, if it was an
  1069.                 'extended' key (i.e., Alt key or function key) it
  1070.                 returns the scan code of the key times 256.  The
  1071.                 keystroke is NOT echoed to the terminal screen.
  1072.                 (See GETS)
  1073.  
  1074.  
  1075.     GETENV(string)
  1076.         Returns: STRING
  1077.         Notes:  This function will scan the OS/2 environment table
  1078.                 for the current process (TE/2) and retrieve the value
  1079.                 associated with the string specified in its argument
  1080.                 or the empty string if the argument was not found in
  1081.                 the environment.
  1082.         Examples:
  1083.                 CmdExe = GETENV("COMSPEC")
  1084.                 MESSAGE("%s", GETENV("PROMPT"))
  1085.  
  1086.  
  1087.     GETYESNO(string, string, integer)
  1088.         Returns: INTEGER, User selection result
  1089.         Notes:  Displays the Yes/No dialog (TE/2 uses this dialog
  1090.                 for querying the user for hangup and exit).  Both
  1091.                 strings are centered in the dialog, string2 may be
  1092.                 NULL.  The integer determines the default answer
  1093.                 (TRUE for Yes, FALSE for No). DLogNormAttr and
  1094.                 DLogHiAttr from the initialization file are used for
  1095.                 the dialog colors. The portion of the screen overlaid
  1096.                 by the dialog are saved and restored when the dialog
  1097.                 is exited.
  1098.                 Returns TRUE if "Yes" was selected, FALSE if "No" was
  1099.                 selected.
  1100.  
  1101.  
  1102.     GETS(integer)
  1103.         Returns: STRING
  1104.         Notes:  Gets a string from the console at the current cursor
  1105.                 location.  The argument specifies the maximum length
  1106.                 of the string, it may be a number from 1 to 255.  If
  1107.                 it is less than one, an empty string is immediately
  1108.                 returned, if it is greater than 255, it is treated as
  1109.                 if it were 255.  GETS retrieves a string from the
  1110.                 user up to, but not including the first carriage
  1111.                 return character or the maximum length whichever
  1112.                 occurs first.  Backspace will erase the previous
  1113.                 character typed (if any) and the ESCape key will
  1114.                 immediately terminate the input and GETS will return
  1115.                 an empty string.  If terminal display is turned on
  1116.                 (see TERMECHO) the input is echoed to the terminal
  1117.                 screen in the current attribute and at the current
  1118.                 cursor location.  (See GETC)
  1119.  
  1120.  
  1121.     HANGUP(special)
  1122.         Returns: INTEGER, TRUE or FALSE
  1123.         Notes:  The "special" argument must be one of TRUE, FALSE, or
  1124.                 IFCARRIER.  If TRUE, the hangup sequence will be
  1125.                 unconditionally performed, if FALSE the user will be
  1126.                 queried for permission, if IFCARRIER, the user will
  1127.                 be queried only if the carrier is high (TE/2 is
  1128.                 online).  The function returns TRUE if the hangup
  1129.                 sequence was successfully transmitted and TE/2 is
  1130.                 no longer on line.
  1131.                 NOTE: The parameter for the HANGUP() statement will
  1132.                   override the current setting of the TE/2 QueryHangUp
  1133.                   initialization variable.
  1134.  
  1135.  
  1136.     ITOA(integer, special)
  1137.         Returns: STRING, ASCII representation of the argument
  1138.         Notes:  The "special" argument must be in the range 2-36,
  1139.                 it specifies the radix for the conversion (number
  1140.                 system base.  If the radix is 10 and the value of
  1141.                 the first argument is negative, a leading '-' sign
  1142.                 is the first character of the result.
  1143.         Examples:
  1144.                 ITOA(1234, 10) returns "1234"
  1145.                 ITOA(8, 2)     returns "1000"
  1146.  
  1147.  
  1148.     JDATE(integer, integer)
  1149.         Returns:  INTEGER, A packed date (in the same format as the
  1150.                   'date' read-only variable) based on the given Julian
  1151.                   day number in the first parameter. Returns 0 on error.
  1152.         Notes:  The first parameter is the Julian Day Number to
  1153.                 translate, the second is a Boolean switch.  If the
  1154.                 second parameter is TRUE, the returned date will be
  1155.                 relative to the Gregorian Calendar otherwise it will
  1156.                 be relative to the Julian Calendar.  If the Julian
  1157.                 Day Number is invalid or the results would be out of
  1158.                 bounds for the requested calendar, the return value
  1159.                 will be 0. (See discussion on Julian date conversions
  1160.                 elsewhere in this document.)
  1161.  
  1162.  
  1163.     JULIAN(integer, integer)
  1164.         Returns:  INTEGER, Julian Day Number or -1 on error.
  1165.         Notes:  The first parameter must be a packed date in the same
  1166.                 format as the 'date' read-only variable.  The second
  1167.                 parameter indicates which calendar to use when
  1168.                 translating the date: TRUE means that this is a
  1169.                 Gregorian date, FALSE implies a Julian date.  The
  1170.                 return value is the Julian Day Number for the given
  1171.                 date.  If the date is invalid for the indicated
  1172.                 calendar, this function returns -1. (See discussion
  1173.                 on Julian date conversions elsewhere in this
  1174.                 document.)
  1175.  
  1176.  
  1177.     JULIAN2(integer, integer, integer, integer)
  1178.         Returns:  INTEGER, Julian Day Number or -1 on error.
  1179.         Notes:  The parameters are, in order: month number (1 to 12),
  1180.                 day number (1 to 31), year number, and a Boolean to
  1181.                 indicate which calendar to use when translating this
  1182.                 date: TRUE means that this is a Gregorian date, FALSE
  1183.                 inplies a Julian Date.  The return value is the Julian
  1184.                 Day Number for the given date.  If the date is invalid
  1185.                 for the indicated calendar, this function returns -1.
  1186.                 (See discussion on Julian date conversions elsewhere in
  1187.                 this document.)
  1188.  
  1189.  
  1190.     JWDAY(integer)
  1191.         Returns: INTEGER, weekday index (0 to 6) or -1 on error.
  1192.         Notes:  The single parameter is a Julian Day Number, the
  1193.                 function will return the weekday index for that
  1194.                 Julian Day (0 is Sunday).  If the Julian Day number
  1195.                 is invalid, the function returns -1.
  1196.  
  1197.  
  1198.     LFAFTERCR(special)
  1199.         Returns: INTEGER, TRUE or FALSE, the new value of LFafterCR
  1200.         Notes:  The "special" parameter must be one of TRUE, FALSE,
  1201.                 or TOGGLE.  If TRUE or FALSE, the value of the
  1202.                 LF-After-CR flag is set to that value, if it is
  1203.                 TOGGLE the flag becomes TRUE if it was FALSE and
  1204.                 vice-versa.
  1205.  
  1206.  
  1207.     LOCALECHO(special)
  1208.         Returns: INTEGER, TRUE or FALSE, the new value of LocalEcho
  1209.         Notes:  The "special" parameter must be one of TRUE, FALSE,
  1210.                 or TOGGLE.  If TRUE or FALSE, the value of the
  1211.                 Local-Echo flag is set to that value, if it is
  1212.                 TOGGLE the flag becomes TRUE if it was FALSE and
  1213.                 vice-versa.
  1214.  
  1215.  
  1216.     LOGCLOSE(void)
  1217.         Returns: INTEGER, TRUE or FALSE
  1218.         Notes:  Closes the currently open log file and returns TRUE,
  1219.                 if there is no currently open log file no action is
  1220.                 performed and the function returns FALSE.
  1221.  
  1222.  
  1223.     LOGFILE(void)
  1224.         Returns: INTEGER, TRUE or FALSE
  1225.         Notes:  This is equivalent to typing Alt-L in terminal mode.
  1226.                 If a log file is currently open this function will
  1227.                 close it and return TRUE, else the user will be
  1228.                 prompted for a log file name to open.  In this case
  1229.                 it returns TRUE if a log file was opened or FALSE if
  1230.                 the user typed ESCape at the prompt of if there was
  1231.                 an error opening the file.
  1232.  
  1233.  
  1234.     LOGOPEN(string, integer)
  1235.         Returns: INTEGER, TRUE or FALSE
  1236.         Notes:  The first argument specifies the log file to open.
  1237.                 This must contain the entire path/name of the file,
  1238.                 default logpath handling is NOT performed on this
  1239.                 string.  The second argument should be TRUE if the
  1240.                 the log file should overwrite any existing file of
  1241.                 the same name, if FALSE, new data will be appended
  1242.                 to the file.
  1243.                 If the first argument is NULL, the user will be
  1244.                 prompted for the file name and overwrite/append mode,
  1245.                 the second parameter is ignored.
  1246.                 The function returns TRUE is a log file was
  1247.                 successfully opened, FALSE if the file was not opened
  1248.                 due to error or user intervention.
  1249.  
  1250.  
  1251.     LOGPAUSE(special)
  1252.         Returns: INTEGER, TRUE or FALSE
  1253.         Notes:  The "special" argument must be one of TRUE, FALSE, or
  1254.                 TOGGLE.  If TRUE, the log file will be placed in the
  1255.                 paused state, if FALSE it will be made active, if
  1256.                 TOGGLE it will alternate states.  The function
  1257.                 returns TRUE if an action was performed, if there is
  1258.                 no currently open log file, it will return FALSE.
  1259.  
  1260.  
  1261.     MAINMENU(special)
  1262.         Returns: INTEGER, TRUE or FALSE
  1263.         Notes:  The "special" argument must be one of TRUE, FALSE, or
  1264.                 TOGGLE.  If TRUE, the TE/2 main menu will be
  1265.                 displayed, if FALSE it will be hidden, if TOGGLE it
  1266.                 will alternate states.  The function returns TRUE if
  1267.                 the menu state was changed.  Note that the
  1268.                 system-global variable "MenuActive" may be examined
  1269.                 to determine the current state of the menu.
  1270.  
  1271.  
  1272.     MESSAGE(string, ... )
  1273.         Returns: INTEGER, the length of the message string
  1274.         Notes:  MESSAGE takes a parameter list identical to the
  1275.                 SPRINTF function, refer to SPRINTF for a more
  1276.                 complete discussion of the format string and its
  1277.                 arguments.  This function will build a string
  1278.                 according to the rules for SPRINTF and display it
  1279.                 on the terminal screen at the current cursor
  1280.                 location.
  1281.  
  1282.  
  1283.     MUXWAIT(string, integer)
  1284.         Returns: INTEGER
  1285.         Notes:  Very much like the related WAITFOR function, MUXWAIT
  1286.                 allows you to specify, in the its first argument, as
  1287.                 many as 10 strings to wait for.  The first character
  1288.                 of the string argument defines the delimiter that
  1289.                 will be in effect for parsing the seperate wait
  1290.                 strings.  This may be any character you choose bit it
  1291.                 should be a character that does not otherwise appear
  1292.                 in any of the substrings (see the examples). MUXWAIT
  1293.                 does not return until one of the specified strings
  1294.                 has been encountered at the comm port, the duration
  1295.                 in seconds specified in the second argument has
  1296.                 elapsed, or the user types ESCape, whichever occurs
  1297.                 first.  Returns the index of the string which was
  1298.                 found or FALSE if a timeout occured or the wait was
  1299.                 aborted by typing ESCape.
  1300.                 Incoming characters are echoed to the terminal screen
  1301.                 unless terminal display is turned off, the log file
  1302.                 is maintained.  (See WAITFOR, WATCHFOR)
  1303.                 If the second parameter is less than zero, normal
  1304.                 timeout processing is disabled and MUXWAIT will not
  1305.                 return until a string has been matched or an ESCape
  1306.                 is typed at the keyboard.
  1307.         Examples:
  1308.                 MUXWAIT("/ENTER to continue/Select:/", 60)
  1309.                         The above example will wait up to 60 seconds
  1310.                         for either the string "ENTER to continue" or
  1311.                         "Select:" to appear at the comm port.  If,
  1312.                         for instance, "Select:" was encountered, the
  1313.                         function returns 2.
  1314.                 MUXWAIT("!Enter name/userid:!What system?!", 30)
  1315.                         Note the use of "!" as the delimiter in this
  1316.                         example rather than the "/" used in the
  1317.                         first.  This example needs to use the slash
  1318.                         as a valid character in one of its searches
  1319.                         thus the different delimiter is mandated.
  1320.  
  1321.  
  1322.     OPENDIALOG(integer, integer, integer, integer, integer)
  1323.         Returns: INTEGER, handle to created dialog
  1324.         Notes:  Creates a dialog box on screen complete with frame
  1325.                 and shadow.  The arguments are, in order, top row,
  1326.                 left column, bottom row, right column, and color
  1327.                 attribute.  The contents of the portion of the screen
  1328.                 overlaid by the dialog box are saved and will be
  1329.                 restored with a subsequent call to CLOSEDIALOG.
  1330.                 The return value is a 'handle' to the dialog.
  1331.  
  1332.  
  1333.     PARMSMNU(void)
  1334.         Returns: INTEGER, always FALSE
  1335.         Notes:  This is equivalent to typing Alt-P from terminal
  1336.                 mode.  The system-global variables "Device", "Port",
  1337.                 "Baud", "WordLen", and "StopBits" may be examined
  1338.                 to determine the current line settings at any time.
  1339.  
  1340.  
  1341.     PGMMENU(void)
  1342.         Returns: INTEGER, always TRUE
  1343.         Notes:  This is equivalent to typing Alt-J in terminal mode.
  1344.  
  1345.  
  1346.     QUEUEDIAL(void)
  1347.         Returns: INTEGER, TRUE or FALSE
  1348.         Notes:  This is equivalent to typing Alt-Q in terminal mode
  1349.                 or "Q" in the dialing directory in that it activates
  1350.                 the Queue Dialer.  The function returns TRUE if a
  1351.                 connection resulted.
  1352.  
  1353.  
  1354.     REDIAL(void)
  1355.         Returns: INTEGER, TRUE or FALSE
  1356.         Notes:  This is equivalent to typing Alt-R in terminal mode in
  1357.                 that the Redialer is activated.  The function returns
  1358.                 TRUE is a connection resulted.
  1359.  
  1360.  
  1361.     RENAME(string, string)
  1362.         Returns: INTEGER, TRUE or FALSE
  1363.         Notes:  This function will attempt to rename the file
  1364.                 specified in the first argument to the new name given
  1365.                 in the second argument.  The function returns TRUE if
  1366.                 it was successful, otherwise an error has occurred.
  1367.                 Further note, this function may be used to move a
  1368.                 file from one subdirectory to another on the same
  1369.                 disk but not across disks.
  1370.         Examples:
  1371.                 RENAME("logfile.log", "logfile.bak")
  1372.                 RENAME("somefile.dat", "\safe\place\somefile.dat")
  1373.  
  1374.  
  1375.     RESTORESCR(integer)
  1376.         Returns: INTEGER, always TRUE
  1377.         Notes:  The argument MUST be a handle to a saved screen that
  1378.                 has been created via an earlier call to SAVESCR or
  1379.                 disaster is sure to follow.  This function will restore
  1380.                 a previously saved screen setup, restoring the video
  1381.                 mode (if neccessary), cursor position, size, and
  1382.                 attribute, and the entire contents of the screen and
  1383.                 frees up all memory used by SAVESCR.
  1384.  
  1385.  
  1386.     RGETC(integer, special)
  1387.         Returns: INTEGER, received character or 0
  1388.         Notes:  This function retrieves one byte of incoming data.
  1389.                 The integer parameter specifies the timeout value in
  1390.                 seconds.  If the timeout period elapses or the user
  1391.                 types an ESCape at the console before a byte of
  1392.                 information is received, RGETC returns 0.
  1393.                 The second, special parameter determines how TE/2 will
  1394.                 echo the character back to the sender.  It may be an
  1395.                 integer or a string.  If it is an integer and is non-zero
  1396.                 then the character will be echoed back to the sender,
  1397.                 if it is zero, or if it is an empty or NULL string,
  1398.                 no character is echoed.  Otherwise, the first character
  1399.                 of the string is echoed back to the sender (use this
  1400.                 for remote entry of passwords, for instance).
  1401.                 Note that by specifying a number less than zero as the
  1402.                 timeout parameter, timeout processing is disabled.
  1403.                 Incoming characters are echoed to the terminal screen
  1404.                 unless terminal display is turned off, the log file
  1405.                 is maintained.
  1406.                 Backspaces are processed and filtered by RGETS before
  1407.                 returning, if echoing is enabled, backspaces,
  1408.                 carriage returns, and line feeds are echoed as
  1409.                 themselves regardless of any translation specified
  1410.                 in parameter 2. (See RGETS)
  1411.  
  1412.  
  1413.     RGETS(integer, integer, special)
  1414.         Returns: STRING, the received data
  1415.         Notes:  This function retrieves incoming data into a string
  1416.                 variable up to the first carriage return or the
  1417.                 string length specified in the first argument or
  1418.                 until the number of seconds specified in the second
  1419.                 argument has elapsed, or until the user types an
  1420.                 ESCape character at the console, whichever occurs first. 
  1421.                 The third, special parameter determines how TE/2 will
  1422.                 echo the characters back to the sender.  It may be an
  1423.                 integer or a string.  If it is an integer and is non-zero
  1424.                 then the characters will be echoed back to the sender,
  1425.                 if it is zero, or if it is an empty or NULL string,
  1426.                 no characters are echoed.  Otherwise, the first character
  1427.                 of the string is echoed back to the sender for each
  1428.                 received character. (use this for remote entry of
  1429.                 passwords, for instance).
  1430.                 Note that by specifying a number less than zero as the
  1431.                 timeout parameter, timeout processing is disabled.
  1432.                 Incoming characters are echoed to the terminal screen
  1433.                 unless terminal display is turned off, the log file
  1434.                 is maintained.
  1435.                 Backspaces are processed and filtered by RGETS before
  1436.                 returning, if echoing is enabled, backspaces,
  1437.                 carriage returns, and line feeds are echoed as
  1438.                 themselves regardless of any translation specified
  1439.                 in parameter 3.
  1440.                 If the length parameter evaluates to 1, backspaces
  1441.                 are NOT filtered or translated.
  1442.                 (See RGETC)
  1443.  
  1444.  
  1445.     RSHELL(string, string, integer)
  1446.         Returns: INTEGER
  1447.         Notes:  Similar in many ways to the SHELL function but subtly
  1448.                 different in several important aspects.  The first string
  1449.                 specifies a program to be executed, the second its arguments.
  1450.                 The program argument MUST be specified, there is no default
  1451.                 value.  When the program is executed, the standard input,
  1452.                 standard output, and standard error system handles are all
  1453.                 redirected to the comm port.  Thus, any program which takes
  1454.                 its input from stdin and writes to stdout and/or stderr,
  1455.                 will receive its input now from the comm port and send its
  1456.                 output back out the comm port.
  1457.                 If the third, integer parameter is non-zero TE/2 will
  1458.                 continue to monitor the status of the connection while the
  1459.                 child process is running.  If a loss of carrier is detected,
  1460.                 the child program will be aborted and control will return
  1461.                 to your script file.
  1462.                 TE/2's screen wil be saved and cleared before executing the
  1463.                 RSHELL program and restored upon return.
  1464.                 The return value is -1 if there was an error otherwise it is
  1465.                 the return code of the program.
  1466.                 RSHELL processes incoming backspace characters
  1467.                 in the expected fashion.
  1468.                 The meaning of the third parameter has been
  1469.                 expanded.  The parameter may take any of the
  1470.                 following values either singly or ORed together:
  1471.                       1 --> watch carrier
  1472.                       2 --> echo incoming characters
  1473.                       4 --> translate cr == cr-lf
  1474.                       8 --> buffer remote input & translate backspaces
  1475.                 Any other bits set in the parameter are ignored.
  1476.                 While in the RSHELL, the remote user has several
  1477.                 special key sequences available that will modify the
  1478.                 behavior.  Each begins with a Control-Backslash
  1479.                 (^\, ascii code 28):
  1480.                       ^\e --> toggles echoing of characters
  1481.                       ^\x --> toggles cr-crlf translation
  1482.                       ^\b --> toggles buffering
  1483.                 Anything else following a ^\ is simply passed
  1484.                 through unchanged (thus ^\^\ == ^\).  Note that the
  1485.                 character codes ARE case sensitive, that is, ^\B is
  1486.                 not the same thing as ^\b.  More special codes may
  1487.                 be added in the future.
  1488.  
  1489.  
  1490.     SAVESCR(void)
  1491.         Returns: INTEGER, handle to saved screen information
  1492.         Notes:  Saves the current contents of the entire screen and
  1493.                 returns a 'handle' to the saved information.  This
  1494.                 information includes the current video mode, the
  1495.                 cursor position, the cursor size and attribute as
  1496.                 well as the actual contents of the screen. If SAVESCR
  1497.                 returns zero then there was not sufficient memory
  1498.                 to perform the operation.
  1499.  
  1500.  
  1501.     SCROLLBACK(void)
  1502.         Returns: INTEGER, TRUE or FALSE
  1503.         Notes:  This is equivalent to typing Alt-W from terminal
  1504.                 mode.  The function returns TRUE unless the Scroll
  1505.                 Back feature is disabled in which case it returns
  1506.                 FALSE.
  1507.  
  1508.  
  1509.     SETCTSRTS(integer)
  1510.         Returns: INTEGER, TRUE or FALSE
  1511.         Notes:  Sets the Cts/Rts handling according to the argument:
  1512.                         0  -  CTS/RTS both off
  1513.                         1  -  CTS on, RTS off
  1514.                         2  -  RTS on, CTS off
  1515.                         3  -  CTS/RTS both on
  1516.                 The function returns TRUE if it was successful.
  1517.  
  1518.  
  1519.     SETCURSOR(integer, integer)
  1520.         Returns: INTEGER, TRUE on success, FALSE on error
  1521.         Notes:  Places the cursor at (row, column) on the terminal
  1522.                 screen. This is direct placement independent of the
  1523.                 current terminal emulation.  The origin is (usually)
  1524.                 the upper lefthand corner and is (0,0).  If the current
  1525.                 terminal emulation is VT100 AND the virtual terminal is
  1526.                 in relative cursor addressing mode AND a scroll region
  1527.                 is set, this function will obey the VT100 emulation's
  1528.                 rules for cursor placement relative to scrolling region.
  1529.                 If the requested location is invalid, this function
  1530.                 will return FALSE.
  1531.  
  1532.     SETPARMS(integer, integer, integer, integer, integer)
  1533.         Returns: INTEGER, TRUE or FALSE
  1534.         Notes:  The arguments are Portnumber, baudrate, parity,
  1535.                 wordlength, and stopbits respectively.  SETPARMS
  1536.                 returns TRUE if it was able to set the specified
  1537.                 parameter configuration.  If it was unsuccessful
  1538.                 NONE of the parameters were changed.  If the port
  1539.                 number changes, the original comm port will be
  1540.                 closed and any active connection severed.  If any
  1541.                 of the parameters are to stay the same either the
  1542.                 appropriate system-global variable should be used
  1543.                 or, alternately a -1 in that position.
  1544.         Examples:
  1545.                 SETPARMS(Port, 2400, 0, 8, 0) sets the current
  1546.                   comm port to 2400 baud, no parity, 8 bit word
  1547.                   length and 1 stop bit.
  1548.                 SETPARMS(-1, 2400, 0, 8, 0) is equivalent to the
  1549.                   previous example.
  1550.                 SETPARMS(-1, 9600, -1, -1, -1) sets the current
  1551.                   comm port to 9600 baud and leaves all other
  1552.                   settings alone.
  1553.                 SETPARMS(Port, 9600, Parity, WordLen, StopBits)
  1554.                   is equivalent to the previous example.
  1555.         Further Notes:
  1556.                 The following is a list of the numbers to use for
  1557.                 setting parity, word length, and stop bits:
  1558.  
  1559.                 Parity:
  1560.                         0  -  no parity
  1561.                         1  -  odd parity
  1562.                         2  -  even parity
  1563.                         3  -  mark parity
  1564.                         4  -  space parity
  1565.  
  1566.                 Word Length:
  1567.                         7  -  7 bit words
  1568.                         8  -  8 bit words
  1569.  
  1570.                 Stop Bits:
  1571.                         0  -  1 stop bit
  1572.                         1  -  1.5 stop bits
  1573.                         2  -  2 stop bits
  1574.  
  1575.  
  1576.     SETXONXOFF(integer)
  1577.         Returns: INTEGER, TRUE or FALSE
  1578.         Notes:  If the argument is zero, XonXoff processing will be
  1579.                 turned off, if the argument is "1" transmit XonXoff
  1580.                 processing will be enabled, if it is "2" receive
  1581.                 XonXoff processing will be enabled, if it is "3" both
  1582.                 transmit and receive XonXoff processing are enabled.
  1583.                 The system-global variable "XonXoff" may be examined
  1584.                 at any time to determine the current state of XonXoff
  1585.                 processing.  The function returns TRUE if it was
  1586.                 successful.
  1587.  
  1588.  
  1589.     SENDBREAK(integer)
  1590.         Returns: INTEGER, the value of its argument
  1591.         Notes:  Will transmit a break signal to the port for the
  1592.                 specified duration in milliseconds.  If a zero value
  1593.                 is specified, the current value of the system-global
  1594.                 variable "BreakLen" is used for the duration.
  1595.  
  1596.  
  1597.     SENDBYTE(integer OR string)
  1598.         Returns: INTEGER, TRUE or FALSE
  1599.         Notes:  Sends the byte specified by either the integer
  1600.                 expression or the first character of the string
  1601.                 expression to the port.  If the character is either
  1602.                 Ctrl-S or Ctrl-Q, the byte is transmitted
  1603.                 immediately.  The function returns TRUE if it was
  1604.                 successful.
  1605.  
  1606.  
  1607.     SENDINIT(void)
  1608.         Returns: INTEGER, TRUE or FALSE
  1609.         Notes:  Transmits the string in the system-global variable
  1610.                 "modemInitStrg" to the comm port.  Returns TRUE if
  1611.                 it was successful.
  1612.  
  1613.  
  1614.     SHELL(string, string)
  1615.         Returns: INTEGER
  1616.         Notes:  Executes the program specified in the first argument
  1617.                 sending it the parameters specified in the second.
  1618.                 If the first argument is NULL, the current value of
  1619.                 the system-global variable "ShellCmd" is used unless
  1620.                 it is also NULL in which case CMD.EXE is executed
  1621.                 with no parameters.  If the first argument is NULL,
  1622.                 the second argument is ignored.  The program is
  1623.                 executed synchronously in the foreground, TE/2 is
  1624.                 suspended while in the shell.  TE/2's screen is saved
  1625.                 before and restored after execution.  The return
  1626.                 value of the function is the return code of the
  1627.                 executed program or -1 if an error occurred.
  1628.                 SHELL(NULL, NULL) is equivalent to typing Alt-O from
  1629.                 terminal mode.
  1630.  
  1631.  
  1632.     SLEEP(integer)
  1633.         Returns: INTEGER, the value of its argument
  1634.         Notes:  Suspends execution of TE/2 for the duration in
  1635.                 milliseconds specified in its argument.
  1636.  
  1637.  
  1638.     SPRINTF(string, ... )
  1639.         Returns: STRING
  1640.         Notes:  SPRINTF receives a format string in its first
  1641.                 argument followed by up to 10 additional arguments
  1642.                 that may be either integers or strings. The arguments
  1643.                 are formatted into a string according to rules
  1644.                 specified by embedded commands in the format string.
  1645.                 With the exception of floating point handling and
  1646.                 pointer notation, all of the functionality of the "C"
  1647.                 functions "printf" and "sprintf" are supported by
  1648.                 TE/2's implementation of SPRINTF, the reader is
  1649.                 referred to the C Language library reference manual of
  1650.                 his or her choice for complete definition of all of
  1651.                 the rules regarding format strings.  Here we will note
  1652.                 the following:
  1653.  
  1654.                   All characters from the format string are copied
  1655.                   to the output string with the following exceptions:
  1656.  
  1657.                   If "%s" is encountered in the format string, the
  1658.                   next unexamined parameter is interpreted as a
  1659.                   string an embedded at that point in the output
  1660.                   string.  The notation "%10s" will right justify the
  1661.                   string in a field of 10 spaces at that point in the
  1662.                   output string. "10" is used by way of example, it
  1663.                   may be any decimal number.  The notation "%-10s"
  1664.                   will likewise left justify the string in a field
  1665.                   of 10 spaces.
  1666.  
  1667.                   If "%d" is encountered in the format string, the
  1668.                   next unexamined parameter is interpreted as a
  1669.                   16 bit signed integer and the ascii representation
  1670.                   of it is embedded into the output string at that
  1671.                   point.  "%ld" interprets the numeric parameter as
  1672.                   a 32-bit signed integer (the native form of all
  1673.                   integers in the TE/2 script language).  "%10d" or
  1674.                   "%10ld" right justifies the number in a field of
  1675.                   10 spaces in the output string, "%010d" or "%010ld"
  1676.                   right justify the number in a field of ten zeros
  1677.                   in the output string.
  1678.  
  1679.                   If "%*s", "%-*s", "%*d", et cetera are encountered
  1680.                   in the format string, these will behave exactly the
  1681.                   same as the examples above with numeric values
  1682.                   except that TWO parameters are expected in the
  1683.                   argument list, the first an integer which will
  1684.                   specify the field width, the second the string or
  1685.                   integer to place in the output string.
  1686.  
  1687.                   If "%%" is encountered in the format string, a
  1688.                   single "%" is placed in the output string.
  1689.  
  1690.                 The arguments to SPRINTF may be literal strings,
  1691.                 string variables, string expressions, numeric
  1692.                 literals, constants, variables, or expressions
  1693.                 in any form or order.  The only restriction is that
  1694.                 the first argument, the format string, must evaluate
  1695.                 to a string.
  1696.  
  1697.                 WARNING
  1698.                 It is not possible to type check all of the
  1699.                 parameters in an SPRINTF (or MESSAGE or TRANSMIT)
  1700.                 argument list.  The script file writer is expected
  1701.                 to take precautions to avoid type mismatches so that
  1702.                 integers are not interpreted as strings and vice
  1703.                 versa.  In general, if a string is interpreted as an
  1704.                 integer there should be no ill effects other than
  1705.                 erroneous output.  If an integer is interpreted as
  1706.                 a string however, a protection violation may well
  1707.                 occur.
  1708.  
  1709.         Examples:
  1710.                 SPRINTF("Hello %s", "World")
  1711.                   returns "Hello World"
  1712.  
  1713.                 SPRINTF("Hello %8s", "world")
  1714.                   returns "Hello    world"
  1715.  
  1716.                 SPRINTF("Hello %-8s", "World")
  1717.                   returns "Hello World   "
  1718.  
  1719.                 SPRINTF("This is the %dth example", 4)
  1720.                   returns "This is the 4th example"
  1721.  
  1722.                 SPRINTF("Action is %03d%% %s", 35, "complete")
  1723.                   returns "Action is 035% complete"
  1724.  
  1725.  
  1726.  
  1727.     STATUS(void)
  1728.         Returns: INTEGER, always FALSE
  1729.         Notes:  This is equivalent to typing Alt-I from terminal mode.
  1730.  
  1731.  
  1732.     STRCMP(string, string)
  1733.         Returns: INTEGER
  1734.         Notes:  Lexigraphically compares two strings, returns zero if
  1735.                 the strings are identical, less than zero if the
  1736.                 first string is "less than" the second, greater than
  1737.                 zero otherwise.
  1738.  
  1739.  
  1740.     STRGET(string, integer, integer, integer, integer, integer, integer)
  1741.         Returns: STRING, user response
  1742.         Notes:  String input routine.  The string parameter is the
  1743.                 default value, and the integer parameters are, in
  1744.                 order, row for the input, column for the input, width
  1745.                 of the input area, maximum input length (may be larger,
  1746.                 smaller or equal to the previous parameter), attribute
  1747.                 for 'first display' of the default, and attribute for
  1748.                 display while the user is editing/inputting.  Returns
  1749.                 the edited string, returns the empty string if the user
  1750.                 pressed ESCape.
  1751.                 Note that input area is NOT saved and restored, it will
  1752.                 remain on screen after the input.
  1753.  
  1754.  
  1755.     STRICMP(string, string)
  1756.         Returns: INTEGER
  1757.         Notes:  Case-insensitive version of STRCMP.  See STRCMP.
  1758.  
  1759.  
  1760.     STRLEFT(string, integer)
  1761.         Returns: STRING
  1762.         Notes:  Returns the leftmost N characters in the string where
  1763.                 N is the number specified in the second argument.  If
  1764.                 N is greater than the length of the string, the
  1765.                 entire string is returned. (see STRRIGHT, SUBSTR)
  1766.  
  1767.  
  1768.     STRLEN(string)
  1769.         Returns: INTEGER, the length of the string
  1770.  
  1771.  
  1772.     STRPUT(integer, integer, integer, string, ... )
  1773.         Returns: INTEGER, length of displayed string
  1774.         Notes:  The integer parameters are, in order, screen row,
  1775.                 screen column, and attribute for display.  The
  1776.                 string is a format string (see SPRINTF) which may
  1777.                 be followed by up to ten additional arguments.
  1778.                 The resulting string is placed at the indicated
  1779.                 position on screen using the indicated attribute.
  1780.                 Return value is the length of the displayed string.
  1781.  
  1782.  
  1783.     STRRIGHT(string, integer)
  1784.         Returns: STRING
  1785.         Notes:  Returns the rightmost N characters in the string where
  1786.                 N is the number specified in the second argument.  If
  1787.                 N is greater than the length of the string, the
  1788.                 entire string is returned. (see STRLEFT, SUBSTR)
  1789.  
  1790.  
  1791.     STRSTR(string, string)
  1792.         Returns: INTEGER
  1793.         Notes:  Scans the string in the first argument for an
  1794.                 occurrence of the string in the second.  Returns zero
  1795.                 if the string was not found else it returns the
  1796.                 position of the second string in the first.
  1797.  
  1798.  
  1799.     STRTRIM(string)
  1800.         Returns: STRING
  1801.         Notes:  Returns a string which is a copy of the string in
  1802.                 its argument with all leading space, tab, carriage
  1803.                 return, and newline characters removed from the
  1804.                 beginning and end.  Embedded spaces, etc., are not
  1805.                 removed.
  1806.  
  1807.  
  1808.     SUBSTR(string, integer, integer)
  1809.         Returns: STRING
  1810.         Notes:  Returns a substring of the string in its argument.
  1811.                 If N is the value of the second argument and M the
  1812.                 value of the third, SUBSTR returns the string which
  1813.                 begins N characters into the first argument and
  1814.                 continues for M characters.  If N is greater than the
  1815.                 length of the string, the empty string is returned,
  1816.                 if N+M is greater than the length of the string, only
  1817.                 the characters in the string from position N to the
  1818.                 end of the string are returned. (see STRLEFT and
  1819.                 STRRIGHT)
  1820.  
  1821.  
  1822.     TERMECHO(special)
  1823.         Returns: INTEGER, TRUE or FALSE
  1824.         Notes:  The special argument must be one of TRUE, FALSE, or
  1825.                 TOGGLE.  TERMECHO will enable or disable the echoing
  1826.                 of characters to the terminal screen.  This effects
  1827.                 both incoming characters from the comm port received
  1828.                 during a WAITFOR, MUXWAIT, RGETS, or RGETC and
  1829.                 characters typed at the keyboard during a GETS call.
  1830.                 It does NOT have any effect on characters received
  1831.                 during a main or higher level PROCESS.
  1832.         Example:
  1833.                 message("Enter string to wait for:")
  1834.                 termecho(FALSE)
  1835.                 waitSrch = gets(255)  ; no screen echo here
  1836.                 waitfor(waitSrch, 60) ; or here
  1837.                 process               ; screen will update during this
  1838.                                       ; but will still be off when we
  1839.                                       ; get back
  1840.  
  1841.  
  1842.     TOLOWER(string)
  1843.         Returns: STRING
  1844.         Notes:  Returns a string which is a copy of its argument
  1845.                 with all upper case letters translated to lower case.
  1846.                 (see TOUPPER)
  1847.  
  1848.  
  1849.     TOUPPER(string)
  1850.         Returns: STRING
  1851.         Notes:  Returns a string which is a copy of its argument
  1852.                 with all lower case letters translated to upper case.
  1853.                 (see TOLOWER)
  1854.  
  1855.  
  1856.     TRACE(integer)
  1857.         Returns: INTEGER, the value of its argument
  1858.         Notes:  Enables and disables trace mode during script file
  1859.                 execution.  When in trace mode each line of the
  1860.                 script file is printed on the terminal display (and
  1861.                 will appear in the scroll back buffer and log file
  1862.                 if one is open) as it is encountered.  This is a
  1863.                 global toggle, once turned on it is on for all
  1864.                 subsequent script file processing until it is turned
  1865.                 off again or until TE/2 ends.
  1866.  
  1867.  
  1868.     TRANSMIT(string, ... )
  1869.         Returns: INTEGER, the length of the message string
  1870.         Notes:  TRANSMIT takes a parameter list identical to the
  1871.                 SPRINTF function, refer to SPRINTF for a more
  1872.                 complete discussion of the format string and its
  1873.                 arguments.  This function will build a string
  1874.                 according to the rules for SPRINTF and transmit
  1875.                 it to the comm port.
  1876.  
  1877.  
  1878.     UPLOAD(special, string)
  1879.         Returns: INTEGER, TRUE or FALSE
  1880.         Notes:  The "special" parameter must be one of the following
  1881.                 pre-defined constants: ASCII, XMODEM, XMODEM1K,
  1882.                 YMODEM, YMODEMG, ZMODEM, or QUERY.  If this parameter
  1883.                 is QUERY, the user is prompted for the protocol.  The
  1884.                 second parameter is the file name, if it is the empty
  1885.                 string, the user is prompted for the file name.
  1886.                 The function returns TRUE if the file transfer ended
  1887.                 with no fatal errors.  (See DOWNLOAD)
  1888.  
  1889.  
  1890.     WAITFOR(string, integer)
  1891.         Returns: INTEGER, TRUE or FALSE
  1892.         Notes:  Does not return until either the string specified in
  1893.                 the first parameter is encountered at the comm port,
  1894.                 the duration in seconds specified in the second
  1895.                 parameter has elapsed, or the user types ESCape,
  1896.                 whichever occurs first.  Returns TRUE if the string
  1897.                 was encountered, FALSE if a timeout occurred or the
  1898.                 wait was aborted by typing ESCape.
  1899.                 Note that specifying a number less than zero as the
  1900.                 timeout parameter, timeout processing is disabled.
  1901.                 Incoming characters are echoed to the terminal screen
  1902.                 unless terminal display is turned off, the log file
  1903.                 is maintained.  (See MUXWAIT, WATCHFOR)
  1904.  
  1905.  
  1906.     WATCHFOR(string, string)
  1907.         Returns: INTEGER, 'handle' for installed watch
  1908.         Notes:  Unlike WAITFOR, which does not return until the
  1909.                 indicated string has been encountered or a set period
  1910.                 of time has elapsed, WATCHFOR installs an asynchronous
  1911.                 'watch' and returns immediately.  The return value is
  1912.                 zero if TE/2 could not install this watch, only 10
  1913.                 watches may be active at any time.  If successful,
  1914.                 the return value is a 'handle' which you will
  1915.                 need to pass to CANCELWATCH when you want to end
  1916.                 the watch.  This handle is therefore every bit as
  1917.                 precious as the handle returned from FOPEN and the
  1918.                 warnings given below in the notes about file handles
  1919.                 apply equally well to watch handles.
  1920.                 The first parameter is the string to 'watch' for.
  1921.                 The second parameter may be nearly any valid TE/2
  1922.                 Script Language assignment statement or function
  1923.                 call.  The statement is not checked for proper syntax
  1924.                 or variable usage until the watch string has been
  1925.                 matched and TE/2 attempts to execute the statement so
  1926.                 you must take care that the syntax is correct and
  1927.                 that any variables referred to in the statement will
  1928.                 be accessible when the statement is to be executed.
  1929.                 Global and system-global variables are always safe
  1930.                 but local variables will cause problems if the watch
  1931.                 is left to continue after the current script has
  1932.                 finished execution or during the execution of any
  1933.                 nested script files or recursive PROCESSes.
  1934.                 Every incoming character from the com port is checked
  1935.                 against the currently active watches, if a watch
  1936.                 string is matched it is tagged for execution.  If
  1937.                 TE/2 is in a process loop at the time, it will be
  1938.                 immediately executed.  However, if a script file
  1939.                 is running at the time, it will not execute until
  1940.                 the current line has finished execution - this means
  1941.                 that a WAITFOR, MUXWAIT, RGETS, RGETC, etc., will not
  1942.                 be interrupted to execute a watch command.
  1943.                 Use the function CANCELWATCH to release a watch that
  1944.                 is no longer needed. (See CANCELWATCH)
  1945.         Example:
  1946.  
  1947.                 integer whand1
  1948.                 integer whand2
  1949.                 integer gotMail = FALSE
  1950.  
  1951.                 program
  1952.                   whand1 = watchfor("ENTER to continue", "sendbyte(13)")
  1953.                   whand2 = watchfor("mail waiting", "gotMail = TRUE")
  1954.                   waitfor("Enter your choice:", 120)
  1955.                   cancelwatch(whand1)
  1956.                   cancelwatch(whand2)
  1957.                   if gotMail
  1958.                     ; et cetera
  1959.  
  1960.  
  1961.  
  1962. Special Notes on the File Handling Functions:
  1963. =============================================
  1964.  
  1965.   The integer value returned from FOPEN is a very important one.  It
  1966. is a file "handle" that is used for all actions performed on that
  1967. file via the other file oriented functions.  This value should NOT be
  1968. modified by your program until the file is safely closed (via a call
  1969. to FCLOSE) and is no longer needed.  Though all the other file
  1970. oriented functions other than FOPEN will accept any integer valued
  1971. expression in the field used for the file handle, it is VERY
  1972. dangerous to use anything but the variable containing the value
  1973. returned from FOPEN.  Any number of problems, up to and including
  1974. general protection violations, may occur is this procedure is not
  1975. followed.
  1976.  
  1977.   The valid open modes for a file that may be used as the second
  1978. argument to FOPEN are given in Table 6 below.  Certain of the file
  1979. oriented functions will operate only on a file which has been opened
  1980. in a mode which permits reading from the file.  FGETS, FGETC, are
  1981. examples of these functions.  Others, like FPUTS and FPUTC, will
  1982. operate only on a file which has been opened on a file which has been
  1983. opened in a mod which allows writing to the file.  Others, like
  1984. FCLOSE and FTELL will work on any open file.
  1985.  
  1986.  
  1987.         Table 6. -- Valid "mode" parameters for FOPEN
  1988.         ---------------------------------------------
  1989.  
  1990.           "r"   open for reading. If the file does not exist,
  1991.                 the FOPEN call will fail.
  1992.  
  1993.           "w"   open an empty file for writing.  If the given
  1994.                 file exists it will be truncated.
  1995.  
  1996.           "a"   open for writing at the end of file (appending)
  1997.                 create the file if it does not exist.
  1998.  
  1999.           "r+"  open for both reading and writing.  If the file
  2000.                 does not exist, the FOPEN call will fail.
  2001.  
  2002.           "w+"  open for both reading and writing.  If the given
  2003.                 file exists it will be truncated.
  2004.  
  2005.           "a+"  open for both reading and appending.  If the file
  2006.                 does not exist it will be created.
  2007.  
  2008.  
  2009.           Translation mode specifiers:
  2010.           ---------------------------
  2011.           One of the following characters may be optionally appended
  2012.           to the mode string, they control the translation mode of
  2013.           the file.  The default mode is "t" (translated) mode so
  2014.           that the use of "t" is unnecessary.
  2015.  
  2016.             "b"   open in binary (untranslated) mode.  Absolutely
  2017.                   no translation is performed on data read from or
  2018.                   written to the file.
  2019.  
  2020.             "t"   open in text (translated) mode.  Carriage return-
  2021.                   line feed combinations are translated to a single
  2022.                   line feed on input, line feed characters are
  2023.                   translated to carriage return-line feed pairs on
  2024.                   output.  Control-Z characters are considered to
  2025.                   be the end of file regardless of their position
  2026.                   in the physical file.  A file opened for writing
  2027.                   or read/writing will have a Control-Z found at the
  2028.                   end of the file removed if possible because the
  2029.                   presence of this character at the end of the file
  2030.                   may cause FSEEK to behave improperly.
  2031.                   Note that the return value of FTELL and the actions
  2032.                   of FSEEK may not be consistent with the actual
  2033.                   physical locations in a file opened in translated
  2034.                   mode.  However, they will behave compatibly, that
  2035.                   is,  FSEEKing to a location previously determined
  2036.                   by a call to FTELL will return the location pointer
  2037.                   to the same spot in the file.
  2038.  
  2039.                   Note: because "t" is the default action for FOPEN,
  2040.                   its use is discouraged.
  2041.  
  2042.  
  2043.  
  2044. Special Notes on Julian Date Conversion Functions:
  2045. ==================================================
  2046.  
  2047.   General notes on the calendars:
  2048.   -------------------------------
  2049.  
  2050.   Julian proleptic dates earlier than January 1, 4713 B.C. are
  2051. invalid, as are Julian dates in the year 0.  Gregorian dates prior to
  2052. October 15, 1582 are also invalid, as are dates with month numbers
  2053. not in the range 1 to 12, or with day numbers less than 1 or greater
  2054. than the number of days in that month.  Invalid dates will cause an
  2055. error return.
  2056.  
  2057.  
  2058.   Julian Date Conversion Functions:
  2059.   ---------------------------------
  2060.  
  2061.   JULIAN(integer packed_date, integer Gregorian)
  2062.   JULIAN2(integer mon, integer day, integer year, integer Gregorian)
  2063.  
  2064.   These two functions return the Julian Day Number corresponding to
  2065. the input calendar date or -1 if given an invalid input date.  If
  2066. parameter 'Gregorian' is non-zero, this denotes input as a Gregorian
  2067. calendar date, otherwise it is a Julian calendar date.  Note that, in
  2068. JULIAN, the date is given in the same packed format as the TE/2
  2069. Script Language read-only variable 'date', in JULIAN2 the date is
  2070. broken out into its componants.  Month ranges from 1 to 12, day from
  2071. 1 to 31 (or less depending on the month).  For Julian B.C. dates,
  2072. express the year as a negative number (remembering, there is no
  2073. Julian Year 0).  These function are, except as noted above,
  2074. identical.
  2075.  
  2076.  
  2077.   JDATE(integer JulianDay, integer Gregorian)
  2078.  
  2079.   Returns date, in packed format, if it can calculate it from the
  2080. Julian Day Number argument (JulianDay), or 0 if it cannot.  If valid,
  2081. the calculated month, day, and year are stored in the return value in
  2082. the same packed format as the TE/2 Script Language read-only variable
  2083. 'date'.  If parameter 'Gregorian' is non-zero, a Gregorian calendar
  2084. date will be calculated, otherwise a Julian calendar date is
  2085. calculated.
  2086.  
  2087.  
  2088.   JWDAY(integer JulianDay)
  2089.  
  2090.   Returns a day-of-week code (0 => Sunday, 1 => Monday, etc.) if
  2091. given a valid Julian Day Number, or -1 if the Julian Day Number is
  2092. invalid.
  2093.  
  2094.